package com.atguigu.day12.comparator06.c1;

import java.util.Comparator;
//todo 按照年龄比
public class SortStudentByAge implements Comparator {
    @Override
    public int compare(Object o1, Object o2) {
        Student s1 = (Student) o1;
        Student s2 = (Student) o2;

        return s1.age-s2.age;
    }
}

class SortStudentByScore implements Comparator<Student> {

    @Override
    public int compare(Student o1, Student o2) {
        if(o1.score>o2.score){
            return 1;
        }else if(o1.score<o2.score){
            return -1;
        }
        return 0;
    }
}